package com.kefu.admin.common.task;

import com.kefu.admin.common.globals.Globals;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * Created by TWD on 2018/8/25.
 */

@Component
@EnableScheduling
public class WaterPenaltyTask {

    private static final Logger logger = LoggerFactory.getLogger(WaterPenaltyTask.class);


    @Autowired
    private Globals globals;
    /**
     * 每天凌晨1点执行滞纳金数据处理
     * */
    //@Scheduled(cron = "0 0 0/1 * * ?")//每小时执行一次，  下午18点
    //@Scheduled(cron="0/10 * *  * * ? ")//每10秒执行一次
    //@Scheduled(cron = "0 0 1 * * ?")//每天凌晨1点执行
    //@ZkLeaderSchedule

    @Scheduled(cron = "0 0 1 * * ?")//每天凌晨1点执行
    public void autoCalcWaterPanalty(){
        logger.info("autoCalcWaterPanalty定时任务状态isTaskoff：{}" , globals.isTaskoff());

        long begin = System.currentTimeMillis();

        long end = System.currentTimeMillis();
        logger.info("自动计算滞纳金定时任务结束，共耗时：[{}]毫秒",(end-begin));

    }


}
